﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using WiTeach.ClassManagement.DAL;
using WiTeach.ClassManagement.Model;
using WiTeach.CourseManagement.View;
using WiTeach.Tools;

namespace WiTeach.ClassManagement.View
{
    /// <summary>
    /// TeachingDemonstration.xaml 的交互逻辑
    /// </summary>
    public partial class TeachingDemonstration : Page
    {
        public int lessonID;
        public int classHourID;
        public TeachingDemonstration(int lessonID,int classHourID)
        {
            InitializeComponent();
            // 修改页面背景主题
            ImageBrush brush = new ImageBrush();
            brush.Stretch = Stretch.Fill;
            brush.ImageSource = new BitmapImage(new Uri(App.backgroundImage, UriKind.RelativeOrAbsolute));
            this.Background = brush;
            this.lessonID = lessonID;
            this.classHourID = classHourID;
        }
        private void backHome(object sender, RoutedEventArgs e)
        {
            CourseIndex courseIndex = new CourseIndex();
            this.NavigationService.Navigate(courseIndex);
        }

        private void backPreLevel(object sender, RoutedEventArgs e)
        {
            this.NavigationService.GoBack();
        }

        private void ProgramWriting(object sender, RoutedEventArgs e)
        {
            // 跳转至程序编写页面
            ProgramWriting programWritingPage = new ProgramWriting(lessonID, classHourID);
            this.NavigationService.Navigate(programWritingPage);
        }

        private void ProgramRecording(object sender, RoutedEventArgs e)
        {
            ProgramRecording programRecording = new ProgramRecording(lessonID, classHourID);
            this.NavigationService.Navigate(programRecording);
        }

        private void TeachingVideo(object sender, RoutedEventArgs e)
        {

            FileHelper fileHelper = new FileHelper();
            List<ClassHour> list = ClassHourDAL.getClassListByID(this.lessonID, this.classHourID);
            string media_path = list[0].VideoName.ToString();
            MediaPlay mp = new MediaPlay(media_path);
            this.NavigationService.Navigate(mp);
        }

        private void TeachingPhoto(object sender, RoutedEventArgs e)
        {
            TeachingPhoto teachingPhoto = new TeachingPhoto(lessonID, classHourID);
            this.NavigationService.Navigate(teachingPhoto);
        }

        private void program_teachingDemon_backmain_mouse_enter(object sender, System.Windows.Input.MouseEventArgs e)
        {
            Image image = sender as Image;
            image.Height = 66;
            image.Width = 104;
        }
        private void program_teachingDemon_backmain_mouse_leave(object sender, System.Windows.Input.MouseEventArgs e)
        {
            Image image = sender as Image;
            image.Height = 60;
            image.Width = 98;
        }
        private void program_teachingDemon_back_mouse_enter(object sender, System.Windows.Input.MouseEventArgs e)
        {
            Image image = sender as Image;
            image.Height = 66;
            image.Width = 104;
        }
        private void program_teachingDemon_back_mouse_leave(object sender, System.Windows.Input.MouseEventArgs e)
        {
            Image image = sender as Image;
            image.Height = 60;
            image.Width = 98;
        }

        private void program_teachingDemon_choice_mouse_enter(object sender, System.Windows.Input.MouseEventArgs e)
        {
            Image image = sender as Image;
            image.Height = 250;
            image.Width = 256;
        }
        private void program_teachingDemon_choice_mouse_leave(object sender, System.Windows.Input.MouseEventArgs e)
        {
            Image image = sender as Image;
            image.Height = 244;
            image.Width = 250;
        }
        private void program_teachingDemon_writing_enter(object sender, System.Windows.Input.MouseEventArgs e)
        {
            Image image = sender as Image;
            image.Height = 100;
            image.Width = 96;
        }
        private void program_teachingDemon_writing_leave(object sender, System.Windows.Input.MouseEventArgs e)
        {
            Image image = sender as Image;
            image.Height = 94;
            image.Width = 90;
        }

        private void program_teachingDemon_recording_enter(object sender, System.Windows.Input.MouseEventArgs e)
        {
            Image image = sender as Image;
            image.Height = 85;
            image.Width = 96;
        }
        private void program_teachingDemon_recording_leave(object sender, System.Windows.Input.MouseEventArgs e)
        {
            Image image = sender as Image;
            image.Height = 80;
            image.Width = 90;
        }
    }
}
